home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d27
/
creatopt.arc
/
PGMRCREA.CLP
< prev
next >
Wrap
Text File
|
1991-12-04
|
10KB
|
135 lines
/* CRTOPT PUBAUT(*ALL) */
/*********************************************************************/
/* PROGRAM- PGMRCREAT */
/* AUTHOR- GREG THIELEN */
/* DATE WRITTEN- MARCH 7, 1988 */
/* PROGRAM DESCRIPTION- BATCH OBJECT CREATION PROCESSOR FOR */
/* PGMREXIT. */
/*********************************************************************/
PGM PARM(&RQS)
DCL VAR(&RQS) TYPE(*CHAR) LEN(239)
DCL VAR(&SRCFILE) TYPE(*CHAR) LEN(10)
DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&SRCMBR) TYPE(*CHAR) LEN(10)
DCL VAR(&RQSLEN) TYPE(*DEC) LEN(3 0)
DCL VAR(&CRTCMD) TYPE(*CHAR) LEN(2000)
DCL VAR(&CMDLEN) TYPE(*DEC) LEN(4 0)
DCL VAR(&CMDINX) TYPE(*DEC) LEN(4 0)
DCL VAR(&OPTID) TYPE(*CHAR) LEN(6)
DCL VAR(&OPTION) TYPE(*CHAR) LEN(50)
DCL VAR(&OPTINX) TYPE(*DEC) LEN(2 0)
DCL VAR(&OPTBEG) TYPE(*DEC) LEN(2 0)
DCL VAR(&OPTLEN) TYPE(*DEC) LEN(2 0)
DCL VAR(&KWDLEN) TYPE(*DEC) LEN(2 0)
DCL VAR(&RQSMSG) TYPE(*CHAR) LEN(256)
DCL VAR(&MSGLEN) TYPE(*DEC) LEN(3 0)
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(256)
DCL VAR(&OPT_FOUND) TYPE(*LGL)
DCLF FILE(QCLSRC)
CHGVAR VAR(&SRCFILE) VALUE(%SST(&RQS 1 10))
CHGVAR VAR(&SRCLIB) VALUE(%SST(&RQS 11 10))
CHGVAR VAR(&SRCMBR) VALUE(%SST(&RQS 21 10))
CHGVAR VAR(&RQSLEN) VALUE(%SST(&RQS 31 3))
CHGVAR VAR(&CRTCMD) VALUE(%SST(&RQS 34 &RQSLEN))
CHGVAR VAR(&CMDLEN) VALUE(&RQSLEN)
OVRDBF FILE(QCLSRC) TOFILE(&SRCFILE.&SRCLIB) +
MBR(&SRCMBR) LVLCHK(*NO)
RCVF: RCVF
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(SNDCRTRQS))
CHGVAR VAR(&OPTID) VALUE(%SST(&SRCDTA 9 6))
CHGVAR VAR(&OPTION) VALUE(%SST(&SRCDTA 16 50))
IF COND(&OPTID *EQ 'CRTOPT') THEN(GOTO +
CMDLBL(CRTOPT))
IF COND(&OPTID *EQ 'CRTCMD') THEN(GOTO +
CMDLBL(CRTCMD))
GOTO CMDLBL(SNDCRTRQS)
/*********************************************************************/
/* EXTRACT CREATE OPTIONS */
/*********************************************************************/
CRTOPT: CHGVAR VAR(&OPTINX) VALUE(1)
GETOPTBEG: /* Get beginning position of create option */
IF COND(%SST(&OPTION &OPTINX 1) *EQ ' ') +
THEN(DO)
IF COND(&OPTINX *GE 50) THEN(GOTO CMDLBL(RCVF))
CHGVAR VAR(&OPTINX) VALUE(&OPTINX + 1)
GOTO CMDLBL(GETOPTBEG)
ENDDO
CHGVAR VAR(&OPTBEG) VALUE(&OPTINX)
GETKWDLEN: /* Get keyword length */
IF COND(%SST(&OPTION &OPTINX 1) *NE '(') +
THEN(DO)
IF COND(&OPTINX *GE 50) THEN(GOTO CMDLBL(RCVF))
CHGVAR VAR(&OPTINX) VALUE(&OPTINX + 1)
GOTO CMDLBL(GETKWDLEN)
ENDDO
CHGVAR VAR(&KWDLEN) VALUE(&OPTINX - &OPTBEG + 1)
/* Check for create option (keyword) already contained in +
submitted command string */
CHGVAR VAR(&OPT_FOUND) VALUE('0')
CHGVAR VAR(&CMDINX) VALUE(1)
FINDOPT: IF COND(%SST(&CRTCMD &CMDINX &KWDLEN) *EQ +
%SST(&OPTION &OPTBEG &KWDLEN)) THEN(CHGVAR +
VAR(&OPT_FOUND) VALUE('1'))
ELSE CMD(DO)
IF COND(&CMDINX *LE (&CMDLEN - &OPTLEN)) THEN(DO)
CHGVAR VAR(&CMDINX) VALUE(&CMDINX + 1)
GOTO CMDLBL(FINDOPT)
ENDDO
ENDDO
IF COND(*NOT &OPT_FOUND) THEN(DO)
/* Get last position of create option */
CHGVAR VAR(&OPTINX) VALUE(50)
GETOPTEND: IF COND(%SST(&OPTION &OPTINX 1) *EQ ' ') +
THEN(DO)
CHGVAR VAR(&OPTINX) VALUE(&OPTINX - 1)
GOTO CMDLBL(GETOPTEND)
ENDDO
/* Append create option to submitted create command +
if enough room */
CHGVAR VAR(&OPTLEN) VALUE(&OPTINX - &OPTBEG + 1)
IF COND((&CMDLEN + &OPTLEN + 1) *LE 2000) THEN(DO)
CHGVAR VAR(&CRTCMD) VALUE(&CRTCMD │> %SST(&OPTION +
&OPTBEG &OPTLEN))
CHGVAR VAR(&CMDLEN) VALUE(&CMDLEN + &OPTLEN + 1)
ENDDO
ENDDO
GOTO CMDLBL(RCVF)
/*********************************************************************/
/* EXTRACT CREATE COMMANDS */
/*********************************************************************/
CRTCMD: SNDPGMMSG MSG(&OPTION) TOPGMQ(*EXT) MSGTYPE(*RQS)
GOTO CMDLBL(RCVF)
/*********************************************************************/
/* SEND CREATE COMMAND REQUEST MESSAGE (in 255 byte increments */
/* if required) */
/*********************************************************************/
SNDCRTRQS: CHGVAR VAR(&CMDINX) VALUE(1)
GETRQS: IF COND(&CMDINX *LE &CMDLEN) THEN(DO)
CHGVAR VAR(&MSGLEN) VALUE(&CMDLEN - &CMDINX + 1)
IF COND(&MSGLEN *GT 256) THEN(DO)
CHGVAR VAR(&MSGLEN) VALUE(255)
CHGVAR VAR(&RQSMSG) VALUE(%SST(&CRTCMD &CMDINX 255) +
││ '-')
ENDDO
ELSE CMD(CHGVAR VAR(&RQSMSG) VALUE(%SST(&CRTCMD +
&CMDINX &MSGLEN)))
SNDPGMMSG MSG(&RQSMSG) TOPGMQ(*EXT) MSGTYPE(*RQS)
CHGVAR VAR(&CMDINX) VALUE(&CMDINX + &MSGLEN)
GOTO CMDLBL(GETRQS)
ENDDO
/*********************************************************************/
/* EXECUTE REQUEST MESSAGES (commands) */
/*********************************************************************/
TFRCTL PGM(QCL)
/*********************************************************************/
RCVERRMSG: RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
MSGF(&MSGF) MSGFLIB(&MSGFLIB)
IF COND(&MSGID *NE ' ') THEN(SNDPGMMSG +
MSGID(&MSGID) MSGF(&MSGF.&MSGFLIB) +
MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE))
ENDPGM